package com.shengxing.lljl.controller;

import cn.hutool.core.util.RandomUtil;
import com.shengxing.lljl.common.Result;
import com.shengxing.lljl.dto.TasksDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 网址表-存储网址以及相关设置 前端控制器
 * </p>
 *
 * @author 小邹
 * @since 2024-10-18
 */

@Api(value = "Url Controller", tags = "流量管理")
@RestController
@Slf4j
@RequestMapping("/lljl/url")
public class UrlController {


    @Autowired
    private RedisTemplate<String, String> redisTemplate;
    /**
     * 添加任务模块，除了内容框的要添加，
     * 侧边栏的设置分流网址，设置计划流量，设置子页访问等也要保存添加\
     * 添加方式:
     *
     * @param tasksDTO
     * @return
     */
    @ApiOperation(value = "添加任务")
    @PostMapping("/addTasks")
    private Result addTasks(TasksDTO tasksDTO) {


        return Result.success();
    }

    @ApiOperation(value = "点击添加任务按钮")
    @GetMapping("/getTasksKey")
    private Result<String> getTasksKey(@RequestParam String email) {
        String key = email+RandomUtil.randomInt(1, 10);
//        redisTemplate.opsForValue().set(key);
        return Result.success(key);
    }



}
